<div class="am-fr" id="pagediv">
</div>
<script>
    $(document).ready(function () {
        $('#example-r').DataTable({
            responsive: true,
            dom: 'ti',
            ordering:false
        });
        $("#pagediv").page({
            pages:${pages},
            groups: 5, //连续显示分页数
            curr:${pageNum},
            first: "首页",
            last: "尾页",
            jump: getPageUrl() + "pageSize=${pageSize}&pageNum=%page%"
        });
    });
    //获取分页用url   (lv)
    function getPageUrl() {
        var url = window.location.href;
        var urls = url.split('?');
        if (urls.length <= 1) {
            return url + "?";
        }
        var base_url = urls[0];
        var paraUrl = urls[1];
        var returnUrl = base_url + "?";
        if (paraUrl.length > 0) {
            var paraUrls = paraUrl.split('&');
            for (var i = 0; i < paraUrls.length; i++) {
                if (paraUrls[i].startWith('pageSize=') || paraUrls[i].startsWith('pageNum=')) {
                    break;
                }
                returnUrl += paraUrls[i] + "&";
            }
        }
        return returnUrl;
    }
    String.prototype.startWith = function (str) {
        if (str == null || str == "" || this.length == 0 || str.length > this.length)
            return false;
        if (this.substr(0, str.length) == str)
            return true;
        else
            return false;
        return true;
    };
</script>